<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
        <title>{$seoinfo['seotitle']}-{$GLOBALS['cfg_webname']}</title>
        {if $seoinfo['keyword']}
        <meta name="keywords" content="{$seoinfo['keyword']}" />
        {/if}
        {if $seoinfo['description']}
        <meta name="description" content="{$seoinfo['description']}" />
        {/if}
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
        {php echo Common::css('base.css,swiper.min.css,reset-style.css');}
        {Common::css_plugin('news.css','news')}
        {php echo Common::js('lib-flexible.js,swiper.min.js,jquery.min.js,delayLoading.min.js');}
	</head>
	<body>
    {request "pub/header_new/typeid/$typeid/islistpage/1"}
        <!-- 公用顶部 -->
        
       <div class="hd-nav swiper-container">
           {st:news action="category" flag="top" return="categorylist"}
           <ul class="clearfix swiper-wrapper">
               <li class="swiper-slide"><a href="{$cmsurl}news/">推荐阅读</a></li>
               {loop $categorylist $category}
               <li data-id="{$category['id']}" class="{if $category_id==$category['id']}on {/if}swiper-slide hd-nav-parent"><a href="{$cmsurl}news/{$category['id']}">{$category['title']}</a></li>
               {/loop}
           </ul>
		</div>
    {loop $categorylist $category}
    {st:news action="category" flag="next" pid="$category['id']" return="childlist"}
    {if $childlist}
       <div class="hd-nav-two swiper-container"  style="display: none">
            <ul class="clearfix swiper-wrapper" data-id="{$category['id']}" >
                <li class="{if $category_id==$category['id']}on {/if} swiper-slide"><a href="{$cmsurl}news/{$category['id']}">最新</a></li>
                {loop $childlist $child}
                <li class="{if $category_id==$child['id']}on {/if} swiper-slide"><a href="{$cmsurl}news/{$child['id']}">{$child['title']}</a></li>
                {/loop}
            </ul>
       </div>
    {/if}
    {/loop}
        
        <div class="image-text-container">
	        <ul class="list-block list-block-mt">

	        </ul>
        </div>
        <!--图文列表-->

       <div class="data-loading" style="display: none"><i></i>加载中…</div>
        <!--加载-->
        
        <div class="data-is-bottom" style="display: none">亲，已经是最底部了~</div>
        <!-- 没有更多数据 -->
        
        <div class="no-data-info" style="display: none">抱歉，没有找到符合条件的资讯信息</div>
        <!-- 没有相关条件信息 -->
	    <script type="text/javascript">
            var page = '{$page}';
            var category = '{$category_id}';
            var allow = 1;
	    	$(function(){
	    		//导航标题
				var swiper = new Swiper('.hd-nav', {
					slidesPerView: 'auto'
				});
                var swiper_1 = new Swiper('.hd-nav-two', {
                    slidesPerView: 'auto',
                    observer:true,
                    observeParents:true
                });
                get_data();
                $(window).scroll(function(){
                    var scroll_top=$(window).scrollTop();
                    if(scroll_top+3>=($(window).outerHeight()-$('.list-block-mt')[0].scrollHeight))
                    {
                        if(allow==1&&page!=-1)
                        {

                            get_data();
                        }
                        else if(page==-1)
                        {
                            $('.data-is-bottom').show();

                        }
                    }
                });



                $('.hd-nav-two li').each(function () {
                    if($(this).hasClass('on'))
                    {
                        $(this).parent().parent().show();
                        var pid = $(this).parent().data('id');
                        if(pid>0)
                        {
                            $('.hd-nav-parent[data-id='+pid+']').addClass('on')
                        }
                    }
                });





	    	});


	    	function get_data()
            {
                $('.data-loading').show();
                allow = 0 ;
                $.ajax({
                    type:'post',
                    dataType:'json',
                    data:{page:page,category:category},
                    url:'{$cmsurl}news/ajax_get_more',
                    success:function (data) {
                        var list = data.list;
                        if(list.length<1&&page==1)
                        {
                            $('.no-data-info').show();
                        }
                        else
                        {
                            $('.no-data-info').hide();
                            $('.data-is-bottom').hide();
                            set_data(list)
                        }
                        allow = 1;
                        page = data.page;
                        $('.data-loading').hide();
                    }
                })
            }

            function set_data(list) {
	    	    var html = '';
	    	    $(list).each(function (index,obj) {
                    html += '<li>' +
                        '<a class="item" href="'+obj.url+'">' +
                        '<div class="pic"><img src="'+obj.litpic+'" alt="'+obj.title+'" title="'+obj.title+'" /></div>' +
                        '<div class="info">' +
                        '<p class="bt">'+obj.title+'</p>' +
                        '<p class="data">' +
                        '<span>'+obj.addtime+'发布</span>' +
                        '<span>'+obj.shownum+'浏览</span></p></div>' +
                        '</a>' +
                        '</li>'

                });
                $('.list-block-mt').append(html)

            }
	    </script>



	</body>
</html>
